//////////////////////////////////
//
// Main application .h
//
//////////////////////////////////

#ifndef _MAIN_H
#define _MAIN_H

#define SWITCH_1 PORTBbits.RB5
#define SWITCH_2 PORTAbits.RA0
#define SWITCH_3 PORTAbits.RA1
#define SWITCH_4 PORTAbits.RA2
#define SWITCH_5 PORTAbits.RA3
#define SWITCH_6 PORTAbits.RA4

typedef enum
{
    HAND_IN = 0,
    HAND_OUT = 1
}hand_state_t;

//typedef union dip_switch{
//    struct {
//    UINT8 switch1 : 1;
//    UINT8 switch2 : 1;
//    UINT8 switch3 : 1;
//    UINT8 switch4 : 1;
//    UINT8 switch5 : 1;
//    UINT8 switch6 : 1;
//    };
//    UINT8 u8;
//}dip_switch;

void process_new_reading(UINT16 new_reading);

void send_control_change_value(UINT16 current_val, UINT8 chan_num);

void send_note_on_off(hand_state_t hand_in_out, UINT8 chan_num);

void check_toggle(UINT8 chan_num);

void send_switch_change(UINT8 chan_num, UINT8 switch_pos);

UINT8 channel_select(UINT8 chan_num);

UINT16 linearise_channel_val(UINT16 channel_val);

#endif
        
